{extend name="layout" /}
{block name="content"}
<div class="layui-tab layui-tab-brief">
	<ul class="layui-tab-title">
	    <li><a href="{:url('index')}">{$pathCurrent['name']}</a></li>
	    <li class="layui-this">{empty name="info"}新增{else /}编辑{/empty}字典</li>
  	</ul>
</div>
<div class="layui-card-body">
	<form class="layui-form" data-model="form-submit">
		<div class="layui-form-item">
			<label class="layui-form-label">字典名称</label>
			<div class="layui-input-block">
				<input type="text" class="layui-input" name="name" value="{$info['name']}" datatype="*">
			</div>
		</div>
		{empty name="info"}
		<div class="layui-form-item">
			<label class="layui-form-label">上级分类</label>
			<div class="layui-input-block">
				<select name="parent_id" lay-filter="aihao">
					<option value="0">顶级字典</option>
					{foreach $group as $vo}
	           		<option value="{$vo['id']}" {if $vo['id'] eq $info['parent_id']}selected=""{/if}>{$vo['name']}</option>
	           		{/foreach}
				</select>
			</div>
		</div>
		{else /}
		<div class="layui-form-item">
			<label class="layui-form-label">上级分类</label>
			<div class="layui-input-block">
				<input type="hidden" class="layui-input" name="parent_id"  value="{$info['parent_id']}" readonly >
				{if $info['parent_id'] eq 0}
					<input type="text" class="layui-input" name="parent_id"  value="顶级字典" readonly >
				{else/}
					{foreach $group as $vo}
						{if $vo['id'] eq $info['parent_id']}
						<input type="text" class="layui-input" name=""  value="{$vo['name']}" readonly >
						{/if}
						{if $vo['id'] eq 0}
						<input type="text" class="layui-input" name="顶级字典"  value="{$vo['name']}" readonly >
						{/if}
					{/foreach}
				{/if}
				
				
			</div>
		</div>
		{/empty}
		<div class="layui-form-item">
			<label class="layui-form-label">排序</label>
			<div class="layui-input-block">
				<input type="text" class="layui-input" name="sort" value="{:isset($info['sort']) ? $info['sort'] : '100'}" datatype="*">
				<div class="layui-form-mid layui-word-aux">数字越小越靠前</div>
			</div>
		</div>
		<div class="layui-form-item">
	    	<div class="layui-input-block">
	    		<input type="hidden" name="id" value="{$info['id']}">
	      		<button class="layui-btn layui-btn-normal">保存</button>
	      		<button type="reset" class="layui-btn layui-btn-primary">重置</button>
	    	</div>
	  	</div>
	</form>
</div>
{/block}
{block name="js"}
<script type="text/javascript">
var mixin = {};
layui.use('form',function(){
	var form = layui.form
});
</script>
{/block}